//
//  MPBarrageWalkSprite.swift
//  maopu
//
//  Created by 黄海波 on 2017/4/10.
//  Copyright © 2017年 maopu. All rights reserved.
//

import UIKit
//import BarrageRenderer

protocol MPBarrageWalkSpriteDelegate:class {
    func barrageViewOnClick()
}

class MPBarrageWalkSprite: BarrageWalkTextSprite {
    
    open weak var barrageDelegate:MPBarrageWalkSpriteDelegate?
    
    func configView() {
        
//        Log.shared.printLog("delegate", str: self.value(forKey: "delegateObject"))
        if self.cornerRadius > 0 {
            self.view.layer.cornerRadius = self.cornerRadius
            self.view.clipsToBounds = true
        }
        self.view.layer.borderColor = self.borderColor.cgColor
        self.view.layer.borderWidth = self.borderWidth
        self.view.backgroundColor = self.backgroundColor
        if (self.clickAction != nil) {
            self.view.isUserInteractionEnabled = true
            let gesture = UITapGestureRecognizer.init(target: self, action: #selector(click))
            self.view .addGestureRecognizer(gesture)
        }
    }
    
    
    func click() {
        if self.clickAction != nil {
            self.clickAction()
        }
    }
    
    override func origin(inBounds rect: CGRect, withSprites sprites: [Any]!) -> CGPoint {
        return super.origin(inBounds: rect, withSprites: sprites)
    }
    
//    - (CGPoint)originInBounds:(CGRect)rect withSprites:(NSArray *)sprites
    
    
}
